package com.ljxy.score.controller.myController;

import com.ljxy.score.common.Result;
import com.ljxy.score.entity.domain.InformationOfExam;
import com.ljxy.score.entity.domain.addDTO;
import com.ljxy.score.entity.domain.deleteDTO;
import com.ljxy.score.entity.domain.updateDTO;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/my_score")
public class MyScoreController {
    @Resource
    private com.ljxy.score.service.myscoreService myscoreService;

    @RequestMapping("/getByClassId")
    public Result<?> getByClassId(@RequestParam("classId") Integer id) {
        return myscoreService.getByClassId(id);
    }

    /**
     * 录入学生信息()
     */
    @PostMapping("/enterInformation")
    public Result<?> enterInformation(@RequestBody InformationOfExam information) {
        return myscoreService.enterInformation(information);
    }


    /**
     * 修改学生成绩
     *
     * @return
     */
    @PostMapping("/updateScore")
    public Result<?> updateScore(@RequestBody updateDTO updateDTO) {
        //1.
        return myscoreService.updateScore(updateDTO);
    }


    @PostMapping("/addScore")
    public Result<?> addScore(@RequestBody addDTO addDTO) {
        //1.
        return myscoreService.addScore(addDTO);
    }


    @PostMapping("/deleteScore")
    public Result<?> deleteScore(@RequestBody deleteDTO deleteDTO) {
        //1.
        return myscoreService.deleteScore(deleteDTO);
    }
}
